package cn.hbu.zlfw.job.dao.impl;

import java.util.Map;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import cn.hbu.zlfw.common.base.dao.impl.BaseDaoImpl;
import cn.hbu.zlfw.common.util.Utility;
import cn.hbu.zlfw.job.dao.MessageHandlerDao;
import cn.hbu.zlfw.job.entity.ShortMessage;
/**
 * 
 *@ClassName:MessageHandlerDaoImpl.java
 *@Description:  短信业务处理Dao层实现类
 *@Author:lxt<839376636@qq.com>
 *@Date:2017年10月9日下午6:55:09
 *@Version:1.1.0
 */
@Repository("messageHandlerDao")
public class MessageHandlerDaoImpl extends BaseDaoImpl<ShortMessage, String> implements MessageHandlerDao{
	
	@Override
	public ShortMessage findShortMessageByParams(Map<String, Object> params) {
		StringBuffer sbf=new StringBuffer();
		sbf.append("from ShortMessage where");
		for (Map.Entry<String, Object> me : params.entrySet()) {
			sbf.append(" "+me.getKey()+"=:"+me.getKey()+" and");
		}
		String querysql= sbf.substring(0, sbf.length()-3);
		Query query=this.getSession().createQuery(querysql);
		return (ShortMessage) Utility.queryParameterUtil(query, params).uniqueResult();
	}
}
